/**
 * Created by novem on 2015/10/29.
 */
window.onload=function(){
    $(".ui-icon-search").on('click',function(){
        var url = getUrl();
        var spotsId = $.getUrlParam('spotsId');
        var wname = $("#search").val();
        $.jsonp({
            url: 'http://'+url+'/api/spotsphoto/spotsphoto_detail-'+spotsId,
            data: {name:wname},
            callbackParameter: "callback",
            success: function (data, textStatus, xOptions) {
                $.each(data.arrays,function(index,item) {
                    item.wname = wname;
                });
                var unixTimestamp = new Date(data.spots.createTime * 1000);
                data.spots.createTime = unixTimestamp.toLocaleString();
                var complied_tpl = juicer($("#jingdian_tpl").text());
                var html = complied_tpl.render(data);
                $(".order-list").append(html);
            },
            error: function (xOptions, textStatus) {
            }
        });
    });
}